package server;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 *  Class Admin
 * The purpose of this class is to provide a series of administrator functions,
 * including registering users, clearing lockouts, and checking different user
 * entities (email, password). These functions are only provided to those with
 * proper clearance.
 * @author vareiss
 * Version 1.0
 */


public class Admin {
        private SeedHandler shandle = new SeedHandler();
        private FarmerHandler fhandle = new FarmerHandler();
    
        public Admin(){
            
        }
    
/**
 * Method makeAdmin
 * 	This method does nothing. Was supposed to give a user
 * admin privileges.
 * @param email
 * @return true on successful privilege transfer, false otherwise
 */
	public boolean makeAdmin(String email) {
		return false;
	}

	/**
	 * Method register
	 * 	This method takes in user information and then creates a corresponding Farmer object.
	 * @param name User's name
	 * @param email User's email address/username
	 * @param password The user's chosen password
	 * @param pubLocation The user's hardinesszone
	 * @param privLocation The user's actual living address
	 * @param aboutMe The user's information
	 * @return True on successful creation, False otherwise
	 */
	public boolean register(String name, String email, String password, int pubLocation, 
			String privLocation, String aboutMe) 
		{
			int passHash = password.hashCode();
			
			
		
		
			boolean register = false;
		try
		{
			fhandle.makeFarmer(name, email, passHash, pubLocation, privLocation, aboutMe);
                         register = true;
		}
		
		catch (Exception e)
		{
			register = false;
		}
		
		finally 
		{
		return register;
		}
	}
	
	
	/**
	 * Method resetLockout
	 * 	This method does nothing.
	 * Was supposed to allow the easy reset of account lockouts
	 * @param email The locked account's username
	 * @return true on successful reset, false otherwise
	 */
	public boolean resetLockout(String email) {
		return false;
	}
	
	/**
	 * Method changePassword
	 * 	This method does nothing.
	 * Was supposed to change the user's password to the new password.
	 * @param email The account's username
	 * @param password The new password that will overwrite the old password
	 * @return true on successful password change, false otherwise
	 */
	public boolean changePassword(String email, String password) {
		return false;
	}
	
	/**
	 * Method makeSeed
	 * 	This method takes in all relevant seed information and sends that info
	 * to the seedHandler class to create a Seed. 
	 * @param comName The seed's common name
	 * @param sciName The seed's scientific name
	 * @param hardiness The seed's hardiness zone
	 * @param reqs Seed's growing requirements (essential for growth)
	 * @param tips Seed's growing tips (helpful but unnecessary)
	 * @param harvestInfo Harvesting information, such as when the plant has ripened
	 * @param startGrow Growing season's beginning
	 * @param stopGrow Growing season's ending
	 * @param farmer The seed's owner
	 * @return true on successful seed creation, false otherwise
	 */
	public boolean makeSeed(String comName, String sciName, int hardiness, String reqs,
			String tips, String harvestInfo, String startGrow, String stopGrow, String farmer) {
		return(shandle.makeSeed(comName, sciName, hardiness, reqs,
			tips, harvestInfo, startGrow, stopGrow, farmer));
	}
	
	/**
	 * Method deleteSeed
	 * 	This method does nothing.
	 * Was supposed to remove a seed from the database.
	 * @param seedID The seed's unique identification number
	 * @return true on successful deletion, false otherwise
	 */
	public boolean deleteSeed(int seedID) {
		return false;
	}
	
	/**
	 * Method checkEmail
	 * 	This method does nothing.
	 * Was supposed to be a security class, checking if the
	 * string was a valid email address
	 * @return true on valid email, false otherwise
	 */
	public boolean checkEmail() {
		return false;
	}
	
	/**
	 * Method checkStr
	 * 	This method does nothing.
	 * Was supposed to be a security class, checking if the string
	 * contained any invalid characters.
	 * @return true on a valid string (containing valid characters), false otherwise
	 */
	public boolean checkStr() {
		return false;
	}
	
	/**
	 * Method isAdmin
	 * 	This method does nothing.
	 * Was supposed to check the user's admin status,
	 * and be called in every admin function to ensure
	 * user's did not have improper access.
	 * @return true if user is an admin, false otherwise
	 */
	public boolean isAdmin() {
		return false;
	}
}

